package com.objectoriented.tang.service;

import java.util.Date;

/**
 用户匹配请求类，统计玩家输赢以及平局的场次
 */
public class RequestUser implements Comparable{
    private final int UID;
    private final int hide_Point;
    private MatchThread myThread;
    private Date questDate;

    public RequestUser(int UID,int hide_Point,Date questDate)
    {
        this.UID=UID;
        this.hide_Point=hide_Point;
        this.questDate=questDate;
    }
    @Override
    public int compareTo(Object o) {
        RequestUser temp = (RequestUser)o;
        if(questDate != temp.questDate)return questDate.compareTo(temp.questDate);
        return Integer.compare(hide_Point,temp.hide_Point);
    }

    public int getUID() {
        return this.UID;
    }

    public void saveThread(MatchThread matchThread)
    {
        this.myThread=matchThread;
    }

    public void awake()
    {
        System.out.println("唤醒进程");
        myThread.resumeThread();
    }

    public void waitFor()
    {
        System.out.println("阻塞进程");
        myThread.pauseThread();
    }
}
